// 导入Mock

const Mock = require('mockjs')

Mock.setup({
  timeout: '100-300' // 设置响应时间
})
// 饼形图
Mock.mock('/mock/echarts/pie', 'get', function(request) {
  console.log(request)
  const data = Mock.mock({
    'list|5': [
      { 'title': '@cname', 'count|1-100': 1 }
    ]
  })
  return {
    success: true,
    msg: '数据获取成功',
    data
  }
})
// 柱状图
Mock.mock('/mock/echarts/bar', 'get', function(request) {
  console.log(request)
  const data = Mock.mock({
    'title|10': [{ title: '@cname', 'count|1-100': 1 }]
  })
  return {
    success: true,
    msg: '数据获取成功',
    data
  }
})
// 折线图
Mock.mock('/mock/echarts/line', 'get', function(request) {
  console.log(request)
  const data = Mock.mock({
    'title|7': [{ title: '@cname', 'count|1-50': 1 }]
  })
  return {
    success: true,
    msg: '数据获取成功',
    data
  }
})
// 雷达图
Mock.mock('/mock/echarts/radar', 'get', function(request) {
  console.log(request)
  const data = Mock.mock({
    'goods|6': [{ title: '@cname', 'count|1-50': 1 }],
    'cate|6': [{ title: '@cname', 'count|50-100': 1 }]
    // total: 100,
    // 'rows|10': [{
    //   // id: '@guid',
    //   // name: '@cname',
    //   // 'age|20-30': 23
    //   'title|4': [{ title: '@county', 'count|100-500': 1 }]
    // }]
  })
  return {
    success: true,
    msg: '数据获取成功',
    data
  }
})
// 地图
Mock.mock('/mock/echarts/map', 'get', function(request) {
  console.log(request)
  const data = Mock.mock({
    'title|4': [{ title: '@county', 'count|100-500': 1 }]
  })
  return {
    success: true,
    msg: '数据获取成功',
    data
  }
})
